package com.foreknow.demo5;

/**
 * 类：具有相同属性和行为的一个模板
 */
public class Student {
    //属性（变量）
    String id;
    String name;
    int age;
    String school;
    //行为（方法）
    public void study(){
        System.out.println("study......");
    }
    public void eat(){
        System.out.println("eat......");
    }
    public void sleep(){
        System.out.println("sleep......");
    }
    public  void game(){
        System.out.println("game......");
    }

    public static void main(String[] args) {
        // 如果想调用类中的方法首先就要创建Student类的对象
        Student stu1 = new Student();
        // 给stu1这个对象的属性赋值
        stu1.id = "s10001";
        stu1.name = "tom";
        stu1.age = 17;
        stu1.school = "fareknow";
        stu1.study();
        stu1.eat();
        stu1.sleep();
        stu1.game();
        Student stu2 = new Student();
        stu2.id = "s10002";
        stu2.name = "fender";
        stu2.age = 12;
        stu2.school = "fareknow";
        stu2.study();
        stu2.eat();
        stu2.sleep();
        stu2.game();

    }
}
